const Router = require('koa-router');
const router = new Router();
const {db, Op, QueryTypes} = require("../../models/db");
// 票据日志
router.post('/bill/getInvoiceLog', async ctx => {
    let user = ctx.user
    let body = ctx.request.body
    let tenantId = user.tenantId;
    let billId = body.billId;
    try {
        let sql = `SELECT a.op,a.uid,convert(varchar(20), a.ctime,120) ctime,b.name  from invoice_log  a inner join admin b on a.uid=b.id where a.iid=${billId} and a.tenantId=${tenantId} `
        let list = await db.query(sql, {type: QueryTypes.SELECT})
        return ctx.suc('', list);
    } catch (e) {
        return ctx.err(e);
    }

})

module.exports = router;